#include <stdio.h>

int main(int argc, char *argv[]) 
{
	int year,d,run,ping,day,week;
	scanf("%d",&year);
	run=(year-1-1900)/4;
	ping=year-1900-run;
	if(year%4==0&&year%100||year%400==0){
		d=run*366+ping*365+121;
		week=d%7;
		day=14-week;
	}
	else{
		d=run*366+ping*365+120;
		week=d%7;
		day=14-week;
	}
	printf("%d\n",day);
}